package com.itheima.health.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import lombok.extern.slf4j.Slf4j;
import java.util.Calendar;
import java.util.Date;

/**
 *@Author Z
 *@Date 2020/4/17 9:48
 *@Version v1.0
 *@Description 处理垃圾文件
 */
@Slf4j
public class ClearDataJob {

    // 依赖注入
    @Reference
    OrderSettingService orderSettingService;

    // 清理预约表中的垃圾数据
    public void clearDataJob(){
        System.out.println("处理垃圾数据开始");
        //清理垃圾数据
        Calendar cl = Calendar.getInstance();
        cl.add(Calendar.MONTH,-2);
        Date date = cl.getTime();
        orderSettingService.deleteorderSetting(date);
        System.out.println("处理垃圾文件结束");
    }
}
